<cfcomponent output="false">
	
	<!--- --->
	
	<cffunction name="getLogs" access="public" output="true" returntype="query">

		<cfreturn application.g.logGateway.getLogs(argumentCollection=arguments) />
		
	</cffunction>
	
	<!--- --->
	
	<cffunction name="groupErrors" access="public" output="true" returntype="struct">
		<cfargument name="types" required="false" default="ajax_error,http_error,error,thread_error,log_error,rest_error" />
		<cfargument name="age" required="false" default="24" />

		<cfset var local = {} />
		
		<cfset local.categories = {} />
		
		<cfloop list="#arguments.types#" index="local.type">
			<cfset local.result = {} />
			<cfset local.errors = $.run.it('logService.getLogs',{name=local.type,age=arguments.age,detail=false}) />
			<cfloop query="local.errors">
				<cfif not structKEyExists(local.result,local.errors.message)>
					<cfset local.result[local.errors.message] = {
						date=local.errors.created,
						count=0
					} />
				</cfif>
				<cfset local.result[local.errors.message].count++ />
			</cfloop>
			
			<cfset local.categories[local.type] = local.result />
		</cfloop>
		
		<cfreturn local.categories>
		
	</cffunction>
	
	<!--- --->

</cfcomponent>